﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HZ.Supervise.Web.Meet
{
    public partial class MeetList : BasePage
    {
        IBLL.IBLL_ProcureCatalog ihc = new HZ.Supervise.BLL.BLL_ProcureCatalog();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindList();
            }
        }

        private void BindList()
        {
            int totalCount = 0;
            string str = "";
            if (!string.IsNullOrEmpty(txtMeetName.Text.Trim()))
            {
                str += string.Format(" and MeetName like '%{0}%'", txtMeetName.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
            {
                str += string.Format(" and MeetStartTime>='{0}'", txtStartTime.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtEndTime.Text))
            {
                str += string.Format(" and MeetEndTime<='{0}'", txtEndTime.Text.Trim());
            }
            DataTable dt = ihc.GetMeetList(str, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount);
            AspNetPager1.RecordCount = totalCount;
            gvw.PageSize = AspNetPager1.PageSize;
            gvw.DataSource = dt;
            gvw.DataBind();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
        }

        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            BindList();
        }
    }
}